//deque 赋值操作
#include <iostream>
#include <deque>
using namespace std;

void printDeque(deque<int> d)
{
    for(deque<int>::iterator iter=d.begin();iter!=d.end();iter++)
    {
        cout<<*iter<<" ";
    }
    cout<<endl;
}

int main()
{
    deque<int> d={9,8,5,2,1,1};
    cout<<"d:";
    printDeque(d);

    deque<int> d1;
    d1=d;
    cout<<"d1:";
    printDeque(d1);

    //使用assign
    deque<int> d2;
    d2.assign(d1.begin()+1,d1.end());
    cout<<"d2:";
    printDeque(d2);

    deque<int> d3;
    d3.assign({9,8,5,2,1,1});
    cout<<"d3:";
    printDeque(d3);

    deque<int> d4;
    d4.assign(8,6);
    cout<<"d4:";
    printDeque(d4);

    return 0;

}
